import { modal } from 'vue-strap'
import { msgConfig, showMsg } from '../../../../vuex/action'

export default {
  name: 'msg-config',
  props: ['title', 'showMsgConfig', 'news'],
  components: {
    'vue-modal': modal
  },
  vuex: {
    actions: {
      xMsgConfig: msgConfig,
      xShowMsg: showMsg
    }
  },
  methods: {
    submit() {
      delete this.news.typeContent
      this.xMsgConfig(this.news)
        .then(() => {
          this.showMsgConfig = false
        })
        .catch((res) => {
          this.xShowMsg({
            type: 'danger',
            content: res.error_msg
          })
        })
    }
  }
}
